package homework3.exp3;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * @author fengq
 */
public class SerializableObj {

	public static void main(String[] args) {

			ObjectOutputStream oos = null;
			try {
				oos = new ObjectOutputStream(new FileOutputStream("D:\\SerializableObj.txt"));
				Student stu = new Student(30,"安娜", "女");
				oos.writeObject(stu);
				System.out.println("写入成功");
			} catch (IOException ex) {
				ex.printStackTrace();
			} finally {
				if(oos!= null) {
					try {
						oos.close();
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
			}
	}

}
